<?php
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/logic/CustomCommand.php';
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/factory/DaoFactory.php';
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/entity/Resource.php';
	
	/*
	* Class to create a resource
	*/
	class CommandCreateResource extends CustomCommand {
		/*
		* Constructor of the class
		*/
		public function __construct($category, $identifier, $specifications, $cost) {
			$this -> resource = new Resource($category, $identifier, $specifications, $cost);
		}
		
		/*
		* Method to execute to create a resources request
		*/
		public function execute() {
			$daoFactory = DaoFactory :: getMySqlDaoFactory();
			$irad = $daoFactory -> getMySqlResourceAccessDao();			
			$resourceCreation = $irad -> createResource($this -> resource);
				
			$GLOBALS['debug'] -> log($resourceCreation, "resourceCreation");
	
			$this -> result = $resourceCreation;
		}
	}
?>